package com.iflytek.bestsellers;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class BestCountBean implements Writable {

    private long comments;//评论数
    private long prices;//定价

    public BestCountBean() {
    }

    public BestCountBean(long comments, long prices) {
        this.comments = comments;
        this.prices = prices;
    }

    public void set(long comments, long prices) {
        this.comments =comments;
        this.prices = prices;
    }

    public long getComments() {
        return comments;
    }

    public void setComments(long comments) {
        this.comments = comments;
    }

    public long getPrices() {
        return prices;
    }

    public void setPrices(long prices) {
        this.prices = prices;
    }

    /**
     * 序列化方法
     */
    @Override
    public void write(DataOutput out) throws IOException {
        out.writeLong(comments);
        out.writeLong(prices);
    }

    /**
     * 反序列化方法 注意顺序
     */
    @Override
    public void readFields(DataInput in) throws IOException {
        this.comments = in.readLong();
        this.prices = in.readLong();
    }

    @Override
    public String toString() {
        return comments + "\t" + prices;
    }

}